package com.soft.service;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.util.Assert;

import com.soft.entity.Sushe;

@SpringBootTest
public class SusheServiceTest {
    @Autowired
    private SusheService susheService;

    //@Test
    public void queryAllTest() {
        List<Sushe> susheList = susheService.queryAll();
        Assert.notEmpty(susheList, "为空");
        Assert.isTrue(susheList.size() > 0, "数据有值");
        // for(int i=0;i<susheList.size();i++) {
        //     System.out.println(susheList.get(i).getSusheFloor());
        // }
    }
    //@Test
    public void queryByCapacityTest() {
        List<Sushe> susheList = susheService.queryByCapacity("acuc");
        Assert.isTrue(susheList.size() == 4, "根据loc进行查询结果的数据不对");
    }
    //@Test
    public void insertoneTest() {
    	int num=susheService.insertOne("十楼","一百");
    	Assert.isTrue(num==1, "增加错误");
    }
    //@Test
    public void deleteoneTest() {
    	int num=susheService.deleteOne("4");
    	Assert.isTrue(num==1, "删除错误");
    }
    //@Test
    public void deletetwoTest() {
    	int num=susheService.deleteTwo("十楼");
    	Assert.isTrue(num==3, "删除错误");
    }
    //@Test
    public void updateoneTest() {
    	int num=susheService.updateOne("57");
    	Assert.isTrue(num==1, "修改错误");
    }
    //@Test
    public void updatetwoTest() {
    	int num=susheService.updateTwo("15");
    	Assert.isTrue(num==2, "修改错误");
    	System.out.println(num);
    }
    
}
